home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / dfpp01.zip / MENUBAR.H < prev    next >
C/C++ Source or Header  |  1992-11-21  |  1KB  |  55 lines

  1. // -------- menubar.h 
  2.  
  3. #ifndef MENUBAR_H
  4. #define MENUBAR_H
  5.  
  6. #include "textbox.h"
  7. #include "popdown.h"
  8.  
  9. enum MenuTerminator { MENU_TERMINATOR };
  10.  
  11. class MenuBarItem    {
  12. public:
  13.     String *title;            // menu bar selection label
  14.     int x1;                    // 1st label position on bar
  15.     int x2;                    // last  "      "     "   "
  16.     MenuSelection **ms;        // popdown selection list
  17.     PopDown *popdown;    // popdown window
  18.     void (*menuprep)();        // menu prep function
  19.     Bool terminator;        // true = terminator entry
  20.  
  21.     MenuBarItem(char *Title, MenuSelection **Ms,
  22.                             void (*MenuPrep)() = NULL);
  23.     MenuBarItem(MenuTerminator Type);
  24.     ~MenuBarItem() { if (title) delete title; }
  25. };
  26.  
  27. class MenuBar : public TextBox    {
  28.     MenuBarItem *menuitems;        // list of popdowns
  29.     int menucount;                // count of popdowns
  30.     int selection;                // current selection on the bar
  31.     Bool ispoppeddown;            // True = a menu is down
  32.     DFWindow *oldfocus;            // previous focus
  33.     void SetColors();
  34.     void Select();
  35.     Bool AcceleratorKey(int key);
  36.     Bool ShortCutKey(int key);
  37. public:
  38.     MenuBar(MenuBarItem *MenuItems, DFWindow *par);
  39.     ~MenuBar();
  40.     // -------- menubar API messages
  41.     void Keyboard(int key);
  42.     void LeftButton(int mx, int my);
  43.     Bool SetFocus();
  44.     void ResetFocus();
  45.     void Paint();
  46.     void Select(int sel);
  47.     void SetSelection(int sel);
  48.     void ParentSized(int xdif, int ydif);
  49. };
  50.  
  51. #endif
  52.  
  53.  
  54.  
  55.